<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.model.Linkman"%>
<%@page import="crm.control.LinkmanControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>linkman_add_do</title>
	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			Linkman linkman = new Linkman();
            int customer_id = ParamUtil.getInt(request,"customer_id",0);
            linkman.setCustomer_id(customer_id);
			String name = ParamUtil.getString(request, "name", null);
			linkman.setName(name);

			String position = ParamUtil.getString(request, "position",null);
			linkman.setPosition(position);

			String email = ParamUtil.getString(request, "email", null);
		    linkman.setEmail(email);

			String phone = ParamUtil.getString(request, "phone",null);
			linkman.setPhone(phone);

		    String hobby = ParamUtil.getString(request, "hobby",null);
			linkman.setHobby(hobby);

			int province_id = ParamUtil.getInt(request, "province_id", 0);
			linkman.setProvince(province_id);

			String qq = ParamUtil.getString(request, "qq", null);
			linkman.setQq(qq);

			String birthaday = ParamUtil.getString(request, "birthday", null);
			linkman.setBirthday(birthaday);

		    String gender = ParamUtil.getString(request,"gender", null);
			linkman.setGender(gender);

			if (LinkmanControl.addLinkman(linkman)) {
		%>
		<script type="text/javascript">
if (window.confirm("添加联系人成功，是否继续添加联系人？"))
	window.location.href = "linkman_add.jsp?customer_id=<%=customer_id%>";
else
	window.top.location.href = "linkman.jsp?id=<%=customer_id%>";
</script>
		<%
			} else {
		%>
		<script type="text/javascript">
if (window.confirm("添加联系人失败，是否继续添加联系人？"))
	window.location.href = "linkman_add.jsp?customer_id=<%=customer_id%>";
else
	window.location.href = "linkman.jsp?id=<%=customer_id%>";
</script>
		<%
			}
		%>
	</body>
</html>